package main.java.FSMDE.models;

import java.util.UUID;

public class TransitionControl extends Transition {

	private Component componentTrigger;

	protected TransitionControl(UUID transitionId, String transitionName) {

		id = transitionId;
		name = transitionName;
		source = null;
		destination = null;
		type = TransitionType.Control;
		componentTrigger = null;
	}

	protected TransitionControl(String transitionName) {

		id = UUID.randomUUID();
		name = transitionName;
		source = null;
		destination = null;
		type = TransitionType.Control;
		componentTrigger = null;
	}

	public void setTriggerComponent(Component component) {
		this.componentTrigger = component;
	}

	public Component getTriggerComponent() {
		return this.componentTrigger;
	}

	@Override
	public String toString() {
		return "<" + this.type + "> " + this.name;
	}

	@Override
	public String getModelDescription() {
		String modelDescription = this.name;
		if (componentTrigger != null) {
			modelDescription += " [" + this.componentTrigger.getName() + " : "
					+ this.componentTrigger.getType() + "]";
		}
		return modelDescription;
	}
}
